#include "globalParamInit.hpp"

void initGlobalParam(GlobalParam &gp, address &add, int &color)
{
    cv::FileStorage fs;
    if(color == RED)
    {
        fs.open(add.camera_config_address+"cameraConfigRed.yaml", cv::FileStorage::READ);
    }
    else
    {
        fs.open(add.camera_config_address+"cameraConfigBlue.yaml", cv::FileStorage::READ);
    }
    fs["color"] >> gp.color;
    fs["switch_INFO"] >> gp.switch_INFO;
    fs["cam_index"] >> gp.cam_index;
    fs["enable_auto_exp"] >> gp.enable_auto_exp;
    fs["energy_exp_time"] >> gp.energy_exp_time;
    fs["armor_exp_time"] >> gp.armor_exp_time;
    fs["r_balance"] >> gp.r_balance;
    fs["g_balance"] >> gp.g_balance;
    fs["b_balance"] >> gp.b_balance;
    fs["enable_auto_gain"] >> gp.enable_auto_gain;
    fs["gain"] >> gp.gain;
    fs["gamma_value"] >> gp.gamma_value;
    fs["trigger_activation"] >> gp.trigger_activation;
    fs["frame_rate"] >> gp.frame_rate;
    fs["enable_trigger"] >> gp.enable_trigger;
    fs["trigger_source"] >> gp.trigger_source;
}